import { legacy_createStore as createStore } from "redux";

const initState = {
  count: 99,
  msg: "hello",
};

function countReducer(state = initState, { type, payload }) {
  console.warn("action  ----->  ", type);
  switch (type) {
    case "add":
      return { count: state.count + payload };

    case "des":
      return { count: state.count - payload };

    default:
      return state;
  }
}

const store = createStore(countReducer);

export default store;
